package com.lx.pc.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class RandomUtils {

	/**
	 * 获取4位随机数
	 * @return
	 */
	public static int random() {
		Random random = new Random();
		int rannum = (int) (random.nextDouble() * (9999 - 1000 + 1)) + 1000;
		return rannum;
	}
	
	/**
	 * 订单随机数
	 * @return
	 */
	public static String random6() {
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		String time = df.format(new Date());
		
		Random random = new Random();
		int rannum = (int) (random.nextDouble() * (99999 - 10000 + 1)) + 1000000;
		time = time + rannum;
		return time;
	}

}
